package com.yjhb.android.sbz.adapter

import android.content.Context
import android.view.View
import android.widget.TextView
import com.bumptech.glide.Glide
import com.yjhb.android.sbz.R
import com.jojo.android.zxlib.base.BaseRecyclerAdapterV2
import com.tencent.imsdk.v2.V2TIMUserFullInfo


/**
 *  创建者 zx
 *  创建时间 2021/3/23 14:13
 */
class BlackListAdapter(context: Context) : BaseRecyclerAdapterV2<BaseRecyclerAdapterV2.BaseHolder, V2TIMUserFullInfo>(context) {


    override fun getLayoutId() = R.layout.item_blacklist
    override fun getHolder(v: View) = BaseHolder(v)


    override fun onBindViewHolder(holder: BaseHolder, position: Int) {
        val friendInfo = data[position]
        Glide.with(context)
                .load(friendInfo.faceUrl)
                .placeholder(R.mipmap.test_head)
                .error(R.mipmap.test_head)
                .into(holder.findViewById(R.id.head_iv))
        holder.findViewById<TextView>(R.id.name_tv).text =
                if (friendInfo.nickName == null || friendInfo.nickName == "") friendInfo.userID else friendInfo.nickName
        val stateTv = holder.findViewById<TextView>(R.id.state_tv)
        stateTv.setOnClickListener {
            itemClickListener?.onViewClick(it, "state", position, data[position])
        }
    }


}